<?php foreach ($contents as $content): ?>
    <li>
        <span class="file">
            <?php if($sf_user->hasCredential('Ver contenido')): ?>
                <?php echo jq_link_to_remote(
                        $content,array(
                            'update' => 'main',
                            'url'    => url_for('content_show',$content),
                            'before' => 'clearView();showLoaderMain();',
                            'complete' => 'hideLoader();'.
                                    ($content->getType()->getType() == 'Sound' ? 'initAudioplayer();' : (
                                        $content->getType()->getType() == 'Video' ? 'initVideoplayer();' : ''
                                    )),
                            'script' => true
                        )) ?>
            <?php else: ?>
                <?php echo $content?>
            <?php endif; ?>
            <a id="<?php echo "content".$content->getId()."_menu_options"?>" tabindex="0" href="#menu_content_options"
                class="content_menu ui-button ui-widget ui-state-default ui-corner-all ui-button-icons-only"
                aria-disabled="false" title="Opciones">
                <span class="ui-button-icon-primary ui-icon ui-icon-circle-plus"></span>
                <span class="ui-button-text">Opciones</span>
                <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
            </a>
            <div id="content_menu_options" class="ui-helper-hidden-accessible">
                <ul>
                    <?php if($sf_user->hasCredential('Ver contenido')): ?>
                        <li>
                            <?php echo jq_link_to_remote(
                                    '<span class="menu-bullet ui-icon ui-icon-bullet"></span> Ver',
                                    array(
                                        'update' => 'main',
                                        'url'    => url_for('content_show',$content),
                                        'before' => 'clearView();showLoaderMain();',
                                        'complete' => 'hideLoader();'.
                                                        ($content->getType()->getType() == 'Sound' ? 'initAudioplayer();' : (
                                                            $content->getType()->getType() == 'Video' ? 'initVideoplayer();' : ''
                                                        )),
                                        'script' => true
                                    )) ?>
                        </li>
                    <?php endif; ?>
                    <?php if($sf_user->hasCredential('Editar contenido')): ?>
                        <li>
                            <?php echo jq_link_to_remote(
                                    '<span class="menu-bullet ui-icon ui-icon-bullet"></span> Editar',
                                    array(
                                        'update' => 'main',
                                        'url'    => url_for('content_edit',$content),
                                        'before' => 'clearView();showLoaderMain();',
                                        'complete' => 'hideLoader();',
                                        'script' => true
                                    )) ?>
                        </li>
                    <?php endif; ?>
                    <?php if($sf_user->hasCredential('Listar comentarios') && $uses_comments): ?>
                        <li>
                            <?php echo jq_link_to_remote(
                                    '<span class="menu-bullet ui-icon ui-icon-bullet"></span> Comentarios',
                                    array(
                                        'update' => 'main',
                                        'url'    => url_for('content_comments',$content),
                                        'before' => 'clearView();showLoaderMain();',
                                        'complete' => 'hideLoader();',
                                        'script' => true
                                    ), array('title' => 'Comentarios realizados sobre '.$content->getTitle())) ?>
                        </li>
                    <?php endif; ?>
                </ul>
            </div>
        </span>
    </li>
<?php endforeach; ?>

